<div id="update_mod">
<div class="mod">
          <div class="mod-tit"><a href="#">Các dự án của bạn</a></div>
          <div id="update">
          <div class=" mod-cont">
            <div class="table">
              <table cellpadding="3" cellspacing="3" border="0" width="100%">
                <tr>
                  <th width="35%">Tên dự án</th>
                  <th >Loại dự án</th>
                  <th width="20%">Hành động</th>
                </tr>
              </table>
            </div>
            <?php foreach($data as $value): ?>
            <div class="table">
              <!--div class="tag-new"><img src="images/new.png" /></div-->
              <table cellpadding="3" cellspacing="3" border="0" width="100%">
                <tr>
                  <td align="center" width="35%"><div class="ava"><a href="<?php echo Yii::app()->createUrl('/job/create/view',array('id'=>$value->id)); ?>"><?php echo $value->name; ?></a></td>
                  <?php if($value->statuspost == 0): ?>
                  <td   align="center">Dự án bình thường<br />
                  <?php else: ?>
                  <td   align="center">Dự án trung gian<br />
                <?php endif; ?>
                  <td width="20%" align="center">
                      <select name="" id="" onchange="javascript:handleSelect(this)">
                          <option value="">Lựa chọn</option>
                          <option value="<?php echo Yii::app()->createUrl('job/create/update',array('id'=>$value->id)) ?>"><a href="">Chỉnh sửa</a></option>
                          <option value="<?php echo $value->id; ?>">Xóa</option>
                      </select>
                  </td>
                </tr>
              </table>
              </div>
            <?php endforeach; ?>
            
          </div>
          </div>
          <div class="clr"></div>
        </div>
</div>
<?php 
                  $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
                                'id'=>'mydialog',
                                // additional javascript options for the dialog plugin
                                'options'=>array(
                                    'title'=>'Chấp nhận dự án',
                                    'autoOpen'=>false,
                                ),
                            ));
                            echo "<h3>Bạn có đồng ý xóa dự án này không?</h3>";
                            echo CHtml::ajaxButton("Chấp nhận",
                              Yii::app()->controller->createUrl('create/delete'), 
                              array('update' => '#update',
                                ),
                              array()
                              );
                            echo CHtml::link('<input type="button" value="Không đồng ý" />', '#', array(
                               'onclick'=>"$('#mydialog').dialog('close');return false;",
                            ));
                        $this->endWidget('zii.widgets.jui.CJuiDialog');
                   ?>
        
            <?php $form=$this->beginWidget('CActiveForm', array(
                'id'=>'search-form',
                'enableAjaxValidation'=>false,
            )); ?>
            <div style="float:right; margin-bottom:10px">
                <a class="btn-refresh-proj-list ns_refresh" style="float:left;padding-right:10px;" title="Refresh" href="#" onclick="return false"></a>
                <div style="padding:6px 5px 0px 0px;float:left;">Show</div>
                <select id="dashboard_per_employer" style="width:60px;font-size:13px;"
                          onchange="javascript:changeQuality(this)">
                    <option value="5">5</option>
                    <option value="10">10</option>
                    <option value="15">15</option>
                    <option value="20">20</option>
                    <option value="100">100</option>
                </select>
            <input type="text" name="input_search" id="search_myjob" class="gaf_textbox" style="width:210px;color:#111111;" value="">
              <img src="<?php echo Yii::app()->request->baseUrl."/data/images/search.jpg"; ?>" onclick="javascript:actionSearch()" height="25px" id="dashboard_searchbtn_employer" style="cursor:pointer;vertical-align:middle">
            </br>
              <p id = "search_error" style="float: right;margin-right: 100px;color: red;"></p>
            <?php $this->endWidget(); ?>
                
            </div>

       <script LANGUAGE="JavaScript">
              function handleSelect(elm)
              {
                if (elm.value.split("/")[3] == "create") {
                    window.location = elm.value;
                }else{
                  $('#mydialog').dialog('open');
                  $.get('?r=job/create/save&id='+elm.value,function(data,status){
                                  });
                  return false;  
                };  
              };
              function changeQuality(va){
                  $.ajax({
                    'type':'get',
                    'url':'?r=job/myjob/quality&value='+va.value,
                    success: function(html){
                      $('#update_mod').html(html);
                    }
                  });
              };
              function actionSearch () {
                if (document.getElementById('search_myjob').value != "") {
                  <?php 
                    echo CHtml::ajax(array(
                                'url'=>Yii::app()->controller->createUrl('/job/myjob/search'),
                                'type'=>'post',
                                'update'=>'#update_mod',
                                'data'=>"js:$('#search-form').serialize()",
                                ))

                 ?>
                 document.getElementById('search_error').innerHTML ="";
               }else{
                document.getElementById('search_error').innerHTML ="Bạn chưa nhập dữ liệu.";
               };
                 document.getElementById('search_myjob').value ="";
              };
      </script>
      
